<template>
  <div>
    <span>选择语言：</span>
    <select v-model="language" placeholder="placeholder">
      <option
        v-for="item in languageList"
        :key="item.value"
        :label="item.label"
        :value="item.value"
      ></option>
    </select>
    <button @click="sendMsg">发送请求</button>

    <div>返回值：{{ resultMsg }}</div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { testI18n } from '@/api/script.js'

const language = ref('zh')
const languageList = ref([
  { label: '中文', value: 'zh' },
  { label: '英文', value: 'en-US' },
])
let resultMsg = ref('')

function sendMsg() {
  testI18n(language.value).then((res) => {
    console.log(res)
    resultMsg.value = res.data
  })
}
</script>
